package day20171011;

import java.util.Scanner;

public class TestCalculator {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        Scanner sc = new Scanner(System.in);
        int result = 0;

        while(true) {
            System.out.println("请输入一个数.");
            int num = s.nextInt();

            System.out.println("请输入运算符(比如 +，-，*，/, =)");
            String ch = sc.nextLine();

            while(true) {
                System.out.println("请输入一个数.");
                int n = s.nextInt();

                while (true) {
                    Choose c = new Choose();
                    result = c.choose(num, ch, n);
                    System.out.println(result);

                    System.out.println("请输入运算符.");
                    ch = sc.nextLine();

                    System.out.println("请输入一个数.");
                    num = s.nextInt();
                }
            }
        }
    }
}

class Choose {
    int choose(int num,String ch,  int count) {
        int result = 0;
        switch (ch) {
            case "+":
                result = num + count;
                break;
            case "-":
                result = num - count;
                break;
            case "*":
                result = num * count;
            case "/":
                result = num / count;
        }
        return result;
    }
}